package com.qd.pandaparkflow.compment.park;

import com.qd.pandaparkflow.context.PriceContext;
import com.yomahub.liteflow.annotation.LiteflowComponent;
import com.yomahub.liteflow.core.NodeSwitchComponent;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;

/**
 * 起步价,这个用来判断是否需要进入按小时计算
 *
 * @author sjk
 */
@ConditionalOnProperty(prefix = "liteflow", name = "enable", havingValue = "true")
@LiteflowComponent(value = "startPriceCond")
@Slf4j
public class StartPriceCond extends NodeSwitchComponent {

    @Override
    public String processSwitch() {
        final PriceContext priceContext = this.getContextBean(PriceContext.class);
        if (priceContext.isHasNextStep()) {
            return "byHourCmp";
        }
        priceContext.getPrintLog().add("不进入按小时计费");
        return null;
    }
}